#ifndef ZXML_PARSER_H_
#define ZXML_PARSER_H_

#include "../Common/GlobalDefines.h"
#include "tinyxml2.h"
#include <map>
#include <vector>
#include <string>

GLOBAL_NAMESPACE_BEGIN

namespace FileTools
{
    class XmlParser
    {
    public:
        typedef std::map<std::string, std::string> Nodes;
    public:
        XmlParser();
        XmlParser(const char* fileName);
        ~XmlParser();

        bool isValid();
        bool loadXml(const char* fileName);
        bool parserConfigFile();

        std::string getElementValue(const char* nodeName, const char* name);
        int     getElementValueToInt(const char* nodeName, const char* name);
        double  getElementValueToDouble(const char* nodeName, const char* name);
        bool    getElementValueToBoolean(const char* nodeName, const char* name);
        std::vector<std::string> collectLevel1Nodes();
        std::vector<double> collectElementValusToDouble(const char* nodeName, const char* name);

        std::string getChildElement();

    private:
        void destroy();


    private:
        tinyxml2::XMLDocument   *document_;
        std::string             fileName_;

        std::map< std::string, Nodes > mpNodes_;
    };
}

GLOBAL_NAMESPACE_END

#endif